import Nerv from "nervjs";
import Taro from "@tarojs/taro-h5";
import Main from './components/Main';
export default class Index extends Taro.Component {
  constructor() {
    super(...arguments);
    /**
     * 指定config的类型声明为: Taro.Config
     *
     * 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型
     * 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string
     * 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型
     */

    // canvasContext: Taro.CanvasContext | null = null;
    this.context = null;
  }
  componentWillMount() {}
  componentDidMount() {
    // const query = Taro.createSelectorQuery();
    // query
    //   .select('#canvas')
    //   .fields({ node: true, size: true })
    //   .exec((res) => {
    //     const canvas: HTMLCanvasElement = res[0].node;
    //     console.log({ res, canvas });
    //     this.canvasContext = canvas.getContext('2d');
    //     // const dpr = Taro.getSystemInfoSync().pixelRatio;
    //     // canvas.width = res[0].width * dpr;
    //     // canvas.height = res[0].height * dpr;
    //     // this.canvasContext && this.canvasContext.scale(dpr, dpr);
    //   });
    // this.canvasContext = Taro.createCanvasContext('myCanvas');
  }
  componentWillUnmount() {}
  componentDidShow() {}
  componentDidHide() {}
  render() {
    return <Main />;
  }
  config = {
    navigationBarTitleText: '首页'
  };
}